package org.arestaurant;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Main extends Activity{
    public static Context CONTEXT;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        CONTEXT = getBaseContext();
        setContentView(R.layout.main);
        //Buttons Setting
        Button foodBtn = (Button) findViewById(R.id.food_btn);
        foodBtn.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Main.this, Foods.class);
                startActivity(intent);
            }
        });
        Button tableBtn = (Button) findViewById(R.id.table_btn);
        tableBtn.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Main.this, Tables.class);
                startActivity(intent);
            }
        });
        Button kitchenBtn = (Button) findViewById(R.id.kitchen_btn);
        kitchenBtn.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                Intent intent = new Intent(Main.this, Kitchen.class);
                startActivity(intent);
            }
        });
    }
   @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.main_menu, menu);
        return true;
    }
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Intent intent;
        switch (item.getItemId()) {
        case R.id.account:
            intent = new Intent(this, Accounts.class);
            startActivity(intent);
            return true;
        case R.id.setting:
            intent = new Intent(this, Setting.class);
            finish();
            startActivity(intent);
            return true;
        case R.id.about:
            intent = new Intent(this, About.class);
            startActivity(intent);
            return true;
        default:
            return true;
        }
    }
}
